<template>
  <section style="display: inline-block;">
    <template v-if="type === 'search'">
      <a-button
        type="primary"
        :disabled="disabled"
        :loading="loading"
        @click="onClick"
      >{{ label?label:'查询' }}</a-button>
    </template>
    <template v-else-if="type === 'reset'">
      <a-button
        :disabled="disabled"
        :loading="loading"
        @click="onClick"
      >{{ label?label:'重置' }}</a-button>
    </template>
    <template v-else-if="type === 'batchDelete'">
      <a-button
        type="danger"
        :disabled="disabled"
        :loading="loading"
        @click="onClick"
      >{{ label?label:'批量删除' }}</a-button>
    </template>
    <template v-else-if="type === 'stop'">
      <a-button
        type="link"
        :disabled="disabled"
        :loading="loading"
        @click="onClick"
        danger
        style="color: #ff4d4f;padding: 0 5px;height: auto"
      >{{ label?label:'停用' }}</a-button>
    </template>
    <template v-else-if="type === 'start'">
      <a-button
        type="link"
        :disabled="disabled"
        :loading="loading"
        @click="onClick"
        style="color: #0b8235;padding: 0 5px;height: auto"
      >{{ label?label:'启用' }}</a-button>
    </template>
    <template v-else>
      <a-button
        type="link"
        :disabled="disabled"
        :loading="loading"
        @click="onClick"
        style="padding: 0 5px;height: auto;"
      >{{ label?label:'label' }}</a-button>
    </template>
  </section>
</template>

<script>
export default {
  name: 'ResealButton',
  props: {
    // 按钮类型
    type: {
      type: String,
      default: ''
    },
    // 文字
    label: {
      type: String,
      default: ''
    },
    loading: {
      type: Boolean,
      default: false
    },
    // 禁止操作
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      inputValue: null
    };
  },
  methods: {
    onClick() {
      this.$emit('click');
    }
  }
};
</script>
